package com.simon.resourcestatistics.controller;

import javax.annotation.Resource;

import com.simon.resourcestatistics.model.ConsumeLog;
import com.simon.resourcestatistics.service.IConsumeLogService;

import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;

@RestController
@RequestMapping("/consumeLog")
public class ConsumeLogController {

    @Resource
    private IConsumeLogService consumeLogService;

    @ApiOperation(value="刷卡",notes = "刷卡")
    @ApiImplicitParam(name="readRoomId",value="资源室编号",required = true,paramType = "path")
    @PutMapping("/{readRoomId}/{cardNo}/{inOrOut}")
    public ConsumeLog enter(@PathVariable Integer readRoomId,@PathVariable String cardNo,@PathVariable boolean inOrOut){
        return consumeLogService.swipingCard(readRoomId, cardNo, inOrOut);
    }

}